home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / RAND / ALL95.LZH / letters_fj / text0016.txt < prev    next >
Encoding:
Text File  |  1995-10-04  |  10.4 KB  |  250 lines

  1. Hi,
  2.  
  3. > >Is that really 100% certain? We're after all only writing a program that
  4. ...
  5. > I don't remember too well. Anyway, this has to be settled.
  6.  
  7. Yes, it can hardly hurt to contact iD in any case. I'd be very surprised
  8. if they have any objections to us writing this program. After all it's not
  9. based on any of their sources, it's unlikely to behave exactly the same and
  10. it's for a computer they might not even know exists.
  11.  
  12. > Perhaps something like WAD, or BAD MOOD, I don't know. It's not very
  13.                                  ^^^^^^^^
  14. I like that one!
  15.  
  16. > important anyway.
  17.  
  18. No, but it'd be more comfortable to have at least a working title,
  19. especially for discussions on newsgroups etc.
  20.  
  21. > >.WADs, though. The main memory hog seems to be the DVIEW temporary arrays
  22. > >if my optimizations don't work.
  23. > What do you mean?
  24.  
  25. The DVIEW rendering engine originally calculated all wall and floor segments
  26. to be drawn before it started drawing anything. This made it necessary to
  27. keep a couple of large arrays with coordinate information. I got rid of
  28. most of that, but introduced some display glitches in the process.
  29. See the old letters at the bottom for more info on this.
  30.  
  31. > >By the way, I wrote a couple of letters about this that I sent to Laurent
  32. > >earlier. Would you like copies?
  33. > Yes. Sure.
  34.  
  35. See at the end.
  36.  
  37. > >Well, it should be rather easy to extend DVIEW to handle texture mapping.
  38. > I don't know. I would do it the other way round. That is, start from scratch
  39. > a new program beginning with the rendering part. We would at first use very
  40.  
  41. In principle there's nothing wrong with that approach of course, but if 
  42. we're to get any kind of speed out of the engine we are likely to end up
  43. with almost the same thing anyway IMO. We can't do the cheating that
  44. everyone else is using with this kind of programs for the Falcon since our
  45. datastructures and their behaviour is already defined.
  46.  
  47. > simple data that we would build by ourselves to test it. Then, extend this
  48. > core, inspiring ourselves from DVIEW as much as possible.
  49.  
  50. I believe that kind of approach is very dangerous. The DVIEW engine for
  51. example runs _much_ faster when the part of the map that's in front of you
  52. is simple. Unfortunately, that's not very common in DOOM.
  53.  
  54. > It's IMO easier to do a good and machine specific program from scratch than
  55. > try to optimize an already existent program. And it's C. Of course, it will
  56. > save a lot of work and should be a constant inspiration and reference. What
  57. > do you think?
  58.  
  59. Well, Laurent seems to think (see bottom) that optimizing DVIEW in assembly
  60. will do wonders. I'm not that sure, though. Running the rendering on the
  61. DSP is quite another matter, but then there's the problem of what to
  62. transfer CPU<->DSP and how.
  63.  
  64. Before any real work is started I suggest that we profile the rendering
  65. engine as far as possible. So far it seems to me that the biggest speedups
  66. will be done at the highest levels (map clipping and projection).
  67.  
  68. > I'll try my ideas about texture mapping as soon as possible. I'll tell you
  69. > about it when I have results. The problem is that I don't have much time to
  70.  
  71. I'm looking forward to hearing about it.
  72.  
  73. > program. And I have to admit that I work on another personal project, but
  74.  
  75. I still haven't made the general release of MGIF, but that's not taking much
  76. time at the moment. Then there is another project that I've had not done
  77. anything about for a couple of years and...
  78.  
  79. > that doesn't take me too much time, fortunately. Anyway, for me, Doom is the
  80. > priority. After my job, of course.
  81.  
  82. Ah, yes there is that as well...
  83.  
  84. > BTW, I've never asked. What do you do in life, apart from programming?
  85.  
  86. I'm a doctoral student researching some new ideas in the field of VLSI
  87. clocking and synchronization. The work also includes about 20% teaching,
  88. so I don't expect to get my PhD before the next millenium (if I do indeed
  89. continue that long and isn't kicked out).
  90.  
  91. In my free time (when I'm not programming) I read a lot (well, at least
  92. it's 10-20kpages/year) of fiction, mostly thriller and fantasy. I also
  93. play the trumpet in a big band and cornet in a brass band. I also took up
  94. fencing recently.
  95.  
  96. What are you doing yourself? I recall your work/school had something to
  97. do with physics.
  98.  
  99. Regards,
  100. Johan
  101.  
  102. ---- here follows some email I've exchanged with Laurent ----
  103. I've incorporated some simple statistics collection in DVIEW which gave
  104. some numbers that are interesting for the optimization. The figures are
  105. approximate averages over more than 200 drawings from five different levels.
  106.  
  107. Function    Calls    Internal loops
  108.                        (1)     (2)
  109. Addfloor     150       1100
  110. Addwall       50       1700
  111. Coldraw      600
  112. Rowdraw     1000
  113. Drawnode     200
  114. Drawssector  100        300
  115. Loadseg      150       1600    400
  116.  
  117. Time for
  118. structure setup:   0.28
  119. actual drawing:    0.08
  120. chunky to planar:  0.11
  121.  
  122. >From this data and some more examining of the code, I've come to the
  123. conclusion that we'll never get anything close to adequate performance
  124. running the 'structure setup' engine on the '030.
  125. (I'd be glad to hear a different opinion.  ;-)
  126. I am, however, almost certain that the necessary data from the .WAD can
  127. be held in the DSPs RAM. The original 'structure engine' used a number
  128. of large arrays, though, which would not have fit. Fortunately, I believe
  129. I have found a way to get rid of almost all of that.
  130.  
  131. Finally, I've given some thought to the sprite drawing and discovered
  132. that it will be even more tricky than I previously thought. The clipping
  133. against walls and floors will be quite difficult. Perhaps even to such
  134. a degree that the extra arrays I mentioned above must actually be
  135. re-inserted, which would be very bad.
  136. If you have any ideas on that I'd be glad to hear about them, since I'm
  137. afraid it will be a major stumbling block for the project.
  138.  
  139. **********************************************
  140.  
  141. > I've started to look at the c source, it looks quite easy
  142. > to translate in 68030. And, of course, in 68030, it'll run
  143. > very FASTER ;-)  than in c, coz we can optimize assembler code, 
  144. > not c code... ;-)
  145.  
  146. I'd be surprised if we could get more than 2-3 times speedup on the
  147. '030, but I'd very much like that suprise...  ;-)
  148.  
  149. > Before the sprites, I'd like to see the maze running fast and
  150. > looking pretty good ...
  151.  
  152. Yes, the maze is of course the more important part, but I worry that
  153. we'll optimize away the stuff that makes the sprites possible.
  154. I'll stop thinking about that for the moment, though.
  155.  
  156. > I think it's not good to start coding details before we know
  157. > how fast can go the essencial. From what you told me, you've
  158. > managed to optimize the structure engine, but from how much ?
  159. > I mean is it big ? ( I mean in memory, of course, to let it
  160. > enter into the dsp).
  161.  
  162. The engine itself is not big at all as you can see from the sources.
  163. I think the sources compile to around 5-10 kbyte m68k object code.
  164. The data from the WAD I've used was also of quite reasonable size.
  165.  
  166. The problem is that the engine used a couple of arrays such as
  167. intersections[50][320], walls[8000] and floorlist[200][40] each of
  168. which must hold 16000 16 bit integers.
  169. The arrays were used to store everything that needed to be drawn. The
  170. actual drawing was then done when everything was ready.
  171. My optimization consisted of drawing walls, floors and ceilings as
  172. soon as they were available, which got rid of all three arrays mentioned,
  173. but introduced a couple of new ones, which fortunately were quite small.
  174. However, I realized yesterday evening that my optimizations will
  175. sometimes produce incorrect displays. The original code drew all floors
  176. before the walls, while I draw a wall(and the closest floor and ceiling)
  177. at a time. In some cases, such as closed doors, there will be clashes...
  178. I hope there's a way to handle this, but I've not discovered it yet.
  179.  
  180. I've heard that SNES DOOM has no floor or ceiling. I'll try that out.
  181.  
  182. > Actually, I'm looking at the c code, trying to understand the
  183. > sequences order, to go faster after.
  184.  
  185. If you have any questions, feel free to ask me. I think I know what's
  186. going on in most of the code now.
  187.  
  188. I guess you've seen that the author says that there must be a lot to
  189. optimize in the actual 3D calculations.
  190. Have you seen anything that can be done there?
  191. Do you have any idea why he does the first clipping (to x = z)? If it's
  192. removed, the most serious display glitches disappear...
  193.  
  194. > We'll probably have to reduce the size of the picture, to have a
  195. > correct speed, the player could choose the size of the window...
  196.  
  197. I'll see how much that improves the speed.
  198.  
  199. > For the sprites, I've got many documents, I'll look what they say
  200. > about it. If you want, I can send you a few documents. Bertrand sent 
  201.  
  202. I'd be interested in that.
  203.  
  204. > Bye for now, tell me when you've got something new.
  205.  
  206. I'll try to send you a new version of DVIEW shortly. This will include
  207. all my test stuff, which might be useful.
  208.  
  209. ******************************************************
  210.  
  211. > I'm actually lookink at the code of dview_falcon. It doesn't seem to
  212. > be so difficult to code in asm. I'll get a .WAD tonight by a PC friend.
  213. > I'll test the programm, and tell you waht about it ...
  214.  
  215. So what did you think?
  216.  
  217. > What's new with you ?
  218.  
  219. I've spent far too much time with DVIEW, so I'm going to leave it as it is
  220. for now. It simply refuses to do as I want...
  221.  
  222. Anyway, the sources are now ordinary C, compilable by GCC or TurboC/PureC.
  223. They're quite ugly at the moment, since I've put quite a lot of debug and
  224. test code in there.
  225.  
  226. If you press 'F' and 'W' while running, the program will switch to the 
  227. mode I think we have to use if we want to run it on the DSP.
  228. Unfortunately I can't get rid of the errors that show up under some
  229. circumstances in that mode. Floors sometimes show through doors and
  230. disturbing glitches occur for some complicated structures.
  231. For good examples of the bugs, go into the room directly on the left
  232. in the first level and look at the top of the stairs. The problem there
  233. is that the wall outside is drawn on top of rest of the room. The
  234. secret door near the end of the level is an example of the 'transparancy'.
  235. If you can fix those bugs, I'd be very happy.
  236.  
  237. By the way, I forgot to mention in the documentation that shows up when 
  238. you start the program that you can change the screen size using the
  239. keys [ and ] for the width and { and } for the height.
  240. DON'T try to increase the size above 320x200!
  241.  
  242.  
  243. -- 
  244.   Chalmers University   | Why are these |  e-mail:   d8klojo@dtek.chalmers.se
  245.      of Technology      |  .signatures  |            rand@cd.chalmers.se
  246.                         | so hard to do |  www/ftp:  rand.thn.htu.se
  247.    Gothenburg, Sweden   |     well?     |            (MGIFv5 and QLem)
  248.  
  249.  
  250.